﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using tiDE.AddIns;
using tiDE;
using System.IO;
using tiDE.Runtime;
using System.Reflection;

namespace tiDEBootAddIn
{
    public class AddIn : IAddIn
    {
        public string Description
        {
            get
            {
                return "Adds functionality to modify the boot code of a TI-83+ SE, TI-84+, or TI-84+ SE";
            }
        }

        public void Initialize()
        {
            
        }

        public void FirstRun()
        {
            // Set up templates
            Stream stream = File.Create(RuntimeData.tiDEUserDirectory + "\\Templates\\BootCode.tidet");
            Stream file = Assembly.GetExecutingAssembly().GetManifestResourceStream("tiDEBootAddIn.BootCode.tidet");
            byte[] buffer = new byte[file.Length];
            file.Read(buffer, 0, (int)file.Length);
            file.Close();
            stream.Write(buffer, 0, (int)buffer.Length);
            stream.Close();
        }

        public string Name
        {
            get
            {
                return "tiDE Boot Code Modification Tools";
            }
        }

        public void Uninitialize()
        {
            
        }

        public Version Version
        {
            get
            {
                return new Version(0, 1, 0, 0);
            }
        }
    }
}
